/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package seso;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "Worker", catalog = "M3ERP", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Worker.findAll", query = "SELECT w FROM Worker w"),
    @NamedQuery(name = "Worker.findByWorkerNo", query = "SELECT w FROM Worker w WHERE w.workerNo = :workerNo"),
    @NamedQuery(name = "Worker.findByWorkerName", query = "SELECT w FROM Worker w WHERE w.workerName = :workerName"),
    @NamedQuery(name = "Worker.findByWage", query = "SELECT w FROM Worker w WHERE w.wage = :wage"),
    @NamedQuery(name = "Worker.findByCompany", query = "SELECT w FROM Worker w WHERE w.company = :company"),
    @NamedQuery(name = "Worker.findByDepartment", query = "SELECT w FROM Worker w WHERE w.department = :department"),
    @NamedQuery(name = "Worker.findByAddress", query = "SELECT w FROM Worker w WHERE w.address = :address")})
public class Worker implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "WorkerNo")
    private String workerNo;
    @Column(name = "WorkerName")
    private String workerName;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "Wage")
    private Double wage;
    @Column(name = "Company")
    private String company;
    @Column(name = "Department")
    private String department;
    @Column(name = "Address")
    private String address;

    public Worker() {
    }

    public Worker(String workerNo) {
        this.workerNo = workerNo;
    }

    public String getWorkerNo() {
        return workerNo;
    }

    public void setWorkerNo(String workerNo) {
        String oldWorkerNo = this.workerNo;
        this.workerNo = workerNo;
        changeSupport.firePropertyChange("workerNo", oldWorkerNo, workerNo);
    }

    public String getWorkerName() {
        return workerName;
    }

    public void setWorkerName(String workerName) {
        String oldWorkerName = this.workerName;
        this.workerName = workerName;
        changeSupport.firePropertyChange("workerName", oldWorkerName, workerName);
    }

    public Double getWage() {
        return wage;
    }

    public void setWage(Double wage) {
        Double oldWage = this.wage;
        this.wage = wage;
        changeSupport.firePropertyChange("wage", oldWage, wage);
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        String oldCompany = this.company;
        this.company = company;
        changeSupport.firePropertyChange("company", oldCompany, company);
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        String oldDepartment = this.department;
        this.department = department;
        changeSupport.firePropertyChange("department", oldDepartment, department);
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        String oldAddress = this.address;
        this.address = address;
        changeSupport.firePropertyChange("address", oldAddress, address);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (workerNo != null ? workerNo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Worker)) {
            return false;
        }
        Worker other = (Worker) object;
        if ((this.workerNo == null && other.workerNo != null) || (this.workerNo != null && !this.workerNo.equals(other.workerNo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "seso.Worker[ workerNo=" + workerNo + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
